﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Manage/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Company.Web.Areas.Manage.Models.NewsModels.IndexModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	新闻管理
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div>
    <% Html.BeginForm(); %>
    <p><%=Html.ActionLink("发布新闻", "add") %></p>
    <table width="100%" class="table">
        <tr class="bar"><th align="left" colspan="9">&nbsp;&nbsp;查找条件</th></tr>
        <tr>
            <td width="50px" align="right"><label for="Serch_Title">标题：</label></td>
            <td align="left" width="220px"><%=Html.TextBoxFor(p=>p.Serch.Title) %></td>
            <td width="50px" align="right"><label for="Serch_Language">语言：</label></td>
            <td align="left" width="80px"><%=Html.DropDownListFor(p=>p.Serch.Language,Model.Languages) %></td>
            <td width="100px" align="right"><label for="Serch_StartTime">添加日期：</label></td>
            <td align="left"><input type="text" onclick = "WdatePicker()"  value='<%=string.Format("{0:yyyy-MM-dd}",Model.Serch.StartTime) %>' class="w80" name="Serch.StartTime" id="Serch_StartTime" /></td>
            <td width="30px" align="right"><label for="Serch_EndTime">至：</label></td>
            <td align="left"><input type="text" onclick = "WdatePicker()" value='<%=string.Format("{0:yyyy-MM-dd}",Model.Serch.EndTime) %>' class="w80" name="Serch.EndTime" id="Serch_EndTime" /></td>
            <td><input name="BtnSerch" type="submit" value="查找" /></td>
        </tr>
    </table>
    <p />
    <table width="100%" class="table" id="items">
        <tr class="bar">
            <th width="120px">日期</th>
            <th>标题</th>
            <th width="50px">类型</th>
            <th width="30px">状态</th>
            <th width="30px">高亮</th>
            <th width="40">点击数</th>
            <th width="80px">
                <label><input type="checkbox" onclick="var ck=this.checked; $('#items #NewID').each(function(){ this.checked=ck;});" />全选</label>
            </th>
        </tr>
        <% foreach (var item in Model.News) %>
        <% { %>
        <tr>
            <td><%=string.Format("{0:yyyy-MM-dd HH:mm}", item.AddTime) %></td>
            <td align="left"><%=string.IsNullOrEmpty(Model.Serch.Title) ? item.Title : item.Title.Replace(Model.Serch.Title, "<span class='serchhight'>" + Model.Serch.Title + "</span>")%></td>
            <td><%=item.Language.Name() %></td>
            <td><%=item.State.Name() %></td>
            <td><%=item.Highlight?"是":"否" %></td>
            <td><%=item.ClickCount %></td>
            <td>
                <%=Html.ActionLink("编辑", "edit", new { ID=item.ID }) %>
                <input type="checkbox" id="NewID" name="NewID" value='<%=item.ID %>' />
            </td>
        </tr>
        <% } %>
        <% if (Model.SumCount == 0) %>
        <% { %>
        <tr><td colspan="7">无记录！</td></tr>
        <% } %>
        <% else %>
        <% { %>
        <tr>
            <td colspan="6"><%=Html.Pager(Model.ID, Model.A, Model.Size, Model.SumCount, "id", Url.Route(new { Model.Serch }), "a")%></td>
            <td><input type="submit" name="Del" value="删除选中" onclick="if($('#items #NewID:checked').length > 0){return confirm('确定要删除吗？');}else{ alert('请先选中要删除的项！'); return false;}" /></td>
        </tr>
        <% } %>
    </table>
    <% Html.EndForm(); %>
</div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="StypeAndScript" runat="server">
    <style type="text/css">
        .serchhight{ color:#FDF786; font-weight:bold;}
        .typepath{ width:100%; }
        .typechilds { border-bottom:1px solid #888;}
        .typechilds,.typechilds ul{ height:auto; overflow:hidden;width:100%}
        .typechilds li{ height:25px; padding:3px 5px; width:150px; text-align:center; float:left;}
    </style>
</asp:Content>